<?php
/*******************************************************************************

	index.ps
	接口入口

	author: scumyang@gmail.com
	create: 2016-12-12
	update: 2017-04-14, update.

*******************************************************************************/

$__swatlibDir = '/services/repo/swatapps/lib';
$__swatPHPDir = "$__swatlibDir/swatPHP";
require_once "$__swatPHPDir/webapp/webAPI.ps";

//------------------------------------------------------------------------------
// 初始化
//------------------------------------------------------------------------------
$__APP_NAME = 'airAuth';
WebApp_InitRunTime( "webapi_$__APP_NAME", "$__APP_NAME", 0 );

//------------------------------------------------------------------------------
// 配置类路由
//------------------------------------------------------------------------------
{
$classFinderConfig = new CStdObject();
$classFinderConfig->classPrefix = 'dapi_';
$classFinderConfig->classDir = $WEBAPP->attr( 'dapiDir' );

$classFinderConfig->logFile = "/services/var/logs/wapi/$__APP_NAME-dapi";
$classFinderConfig->logDetail = 0;

$classFinderConfig->responseText = 0;
$classFinderConfig->responseJSON = 1;

$classFinderConfig->dao = $HELPER->dao( null, $__APP_NAME );

// 创建类路由实例
$classFinder = new ClassFinder( $classFinderConfig );
}

//------------------------------------------------------------------------------
// 初始化 Restful 入口
//------------------------------------------------------------------------------
$wr = new CWebRester( array( 'logDir'=>  "/services/var/logs/wapi/$__APP_NAME-rest" ));

// 注册路由 URI
$wr
	// webapi 接口
	// webapi 接口
	->action( "/version", 'airAuth', 'version' )
	->action( "/depCheck", 'airAuth', 'depCheck' )
	
	->action( "/test", 'airAuth', 'testCase' )
	->action( "/bsn", 'airAuth', 'bsn' )
	
	->action( "/login", 'airAuth', 'login' )
	->action( "/auth", 'airAuth', 'auth' )
	->action( "/ping", 'airAuth', 'ping' )
	->action( "/portal", 'airAuth', 'portal' )

	->action( "/getCaptcha", 'airAuth', 'getCaptcha' )
	
	->dispatch()
	;

//------------------------------------------------------------------------------

?>
